package com.android.systemui.zooking;

import com.android.systemui.SystemUIApplication;

import android.content.Context;
import android.content.SharedPreferences;

public class Cfg {
	private static String SP_NAME_CFG = "zooking_cfg";
	private static String SP_KEY_LOCKSCREEN_ZIP_PATH = "lockscreen_zip_path"; 
	private static String SP_KEY_IS_ZOOKING_LOCKSCREEN = "is_zooking_lockscreen";
	private static String SP_KEY_RESTART_SYSTEMUI_CASUE = "restart_systemui_cause";
	private static Context mContext;
	public static void initCfg(Context context) {
		mContext = context;
	}
	
	public static boolean isZookingLockScreen() {
		if(mContext == null ) {
			mContext = SystemUIApplication.getInstance().getApplicationContext();
		}
		SharedPreferences sp = mContext.getSharedPreferences(SP_NAME_CFG, Context.MODE_PRIVATE);
		return sp.getBoolean(SP_KEY_IS_ZOOKING_LOCKSCREEN, false);
	}
	
	public static void setZookingLockScreen(boolean isZookingLockScreen) {
		if(mContext == null ) {
			mContext = SystemUIApplication.getInstance().getApplicationContext();
		}
		SharedPreferences sp = mContext.getSharedPreferences(SP_NAME_CFG, Context.MODE_PRIVATE);
		sp.edit().putBoolean(SP_KEY_IS_ZOOKING_LOCKSCREEN, isZookingLockScreen).commit();
	}
	
	public static String getLockscreenZipPath() {
		if(mContext == null ) {
			mContext = SystemUIApplication.getInstance().getApplicationContext();
		}
		SharedPreferences sp = mContext.getSharedPreferences(SP_NAME_CFG, Context.MODE_PRIVATE);
		return sp.getString(SP_KEY_LOCKSCREEN_ZIP_PATH, null);
	}
	
	public static void setLockscreenZipPath (String zipPath) {
		if(mContext == null ) {
			mContext = SystemUIApplication.getInstance().getApplicationContext();
		}
		SharedPreferences sp = mContext.getSharedPreferences(SP_NAME_CFG, Context.MODE_PRIVATE);
		sp.edit().putString(SP_KEY_LOCKSCREEN_ZIP_PATH, zipPath).commit();
	}
	
	public static boolean isRestartBeacauseChangeTheme() {
		if(mContext == null ) {
			mContext = SystemUIApplication.getInstance().getApplicationContext();
		}
		SharedPreferences sp = mContext.getSharedPreferences(SP_NAME_CFG, Context.MODE_PRIVATE);
		return sp.getBoolean(SP_KEY_RESTART_SYSTEMUI_CASUE, false);
	}
	
	public static void setRestartBeacauseChangeTheme(boolean cauese) {
		if(mContext == null ) {
			mContext = SystemUIApplication.getInstance().getApplicationContext();
		}
		SharedPreferences sp = mContext.getSharedPreferences(SP_NAME_CFG, Context.MODE_PRIVATE);
		sp.edit().putBoolean(SP_KEY_RESTART_SYSTEMUI_CASUE, cauese).commit();
	}
}
